<template>
	<view>
		<button @click="callSetStorage()">console.log</button>
		<button @click="callGetStorage()">获取缓存</button>
		<button @click="callStoInfo()">获取字段列表</button>
		<button @click="callStoInfo1()" type="warn" plain="true">删除</button>
		<button @click="callStoInfo2()" type="warn">清空</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			callSetStorage(){
				console.log("callSetStorage--> userName gyc");
				uni.setStorage({
					key:"userName",
					data:"gyc",
					success(){
						console.log("存储userName 成功回调");
					},
					fail(){
						console.log("存储userName 成功失败");
					}
					// complete() {
					// 	console.log("做完了");
					// }
				})
			},
			callGetStorage(){
				uni.getStorage({
					key:"Account",
					success:function(result){
						console.log("获取本地缓存成功 result.data:" + result.data);
					},
					fail:function(e){
						console.error("获取本地缓存失败:" + JSON.stringify(e));
						console.error("获取本地缓存失败:" + e.errMsg);
					}
				})
			},
			callStoInfo(){
				console.log("callStoInfo-->");
				uni.getAppBaseInfo({
					success:function(result){
						console.log("callStoInfo--> " + JSON.stringify(result));
						console.log("callStoInfo--> " + result.keys);
						// console.log("callStoInfo--> " + result.currentSize);
					}
				})
			},
			callStoInfo1(){
				uni.removeStorage({
					key:"gyc",
					success() {
						console.log();
					},
					fail() {
						console.log();
					}
				})
			}
		}
	}
</script>

<style>
button{
	margin: 20rpx;
}
</style>
